package com.tzpay.tzpay.api.service;

import com.tzpay.tzpay.api.OrderCreate;
import com.tzpay.tzpay.api.OrderCreateRequest;
import com.tzpay.tzpay.api.OrderQuery;
import com.tzpay.tzpay.api.ResponseDataWrapper;

import java.util.HashMap;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;

/**
 * Description:
 * Created:      [16/3/15]
 * Author:       [Yang]
 **/
public interface OrderService {
    @POST("/barcode/placeOrder")
    Call<ResponseDataWrapper<OrderCreate>> orderCreate(@Body OrderCreateRequest request);


    @FormUrlEncoded
    @POST("/barcode/placeOrder")
    Call<ResponseDataWrapper<OrderCreate>> orderCreate(@Field("merchantId") String merchantId,
                                                       @Field("subMerchantId") String subMerchantId,
                                                       @Field("barcode") String barcode,
                                                       @Field("orderNo") String orderNo,
                                                       @Field("orderReqNo") String orderReqNo,
                                                       @Field("channel") String channel,
                                                       @Field("busiType") String busiType,
                                                       @Field("orderDate") String orderDate,
                                                       @Field("orderAmt") String orderAmt,
                                                       @Field("productAmt") String productAmt,
                                                       @Field("attachAmt") String attachAmt,
                                                       @Field("goodsName") String goodsName,
                                                       @Field("storeId") String storeId,
                                                       @Field("backUrl") String backUrl,
                                                       @Field("ledgerDetail") String ledgerDetail,
                                                       @Field("attach") String attach,
                                                       @Field("mac") String mac);

    /**
     * @param merchantId
     * @param orderNo
     * @param orderReqNo
     * @param orderDate  日期格式：yyyyMMdd
     * @param mac        默认为0，当加密方式为1时有意义，采用标准的MD5算法，由商户实现
     * @return
     */
    @FormUrlEncoded
    @POST("/query/queryOrder")
    Call<ResponseDataWrapper<OrderQuery>> orderQuery(@Field("merchantId") String merchantId,
                            @Field("orderNo") String orderNo,
                            @Field("orderReqNo") String orderReqNo,
                            @Field("orderDate") String orderDate,
                            @Field("mac") String mac);


    @FormUrlEncoded
    @POST("/refund/commonRefund")
    Call<ResponseDataWrapper<String>> orderRefund(@Field("merchantId") String merchantId,
                             @Field("subMerchantId") String subMerchantId,
                             @Field("merchantPwd") String merchantPwd,
                             @Field("oldOrderNo") String oldOrderNo,
                             @Field("oldOrderReqNo") String oldOrderReqNo,
                             @Field("refundReqNo") String refundReqNo,
                             @Field("refundReqDate") String refundReqDate,
                             @Field("transAmt") String transAmt,
                             @Field("channel") String channel,
                             @Field("ledgerDetail") String ledgerDetail,
                             @Field("bgUrl") String bgUrl,
                             @Field("mac") String mac);

    @FormUrlEncoded
    @POST("/reverse/reverse")
    Call<ResponseDataWrapper<String>> orderReverse(@Field("merchantId") String merchantId,
                              @Field("subMerchantId") String subMerchantId,
                              @Field("merchantPwd") String merchantPwd,
                              @Field("oldOrderNo") String oldOrderNo,
                              @Field("oldOrderReqNo") String oldOrderReqNo,
                              @Field("refundReqNo") String refundReqNo,
                              @Field("refundReqDate") String refundReqDate,
                              @Field("transAmt") String transAmt,
                              @Field("channel") String channel,
                              @Field("ledgerDetail") String ledgerDetail,
                              @Field("bgUrl") String bgUrl,
                              @Field("mac") String mac);
}
